package com.osmino.contacts.provider;

import android.content.Context;
import android.os.AsyncTask;
import android.widget.BaseAdapter;
import com.osmino.contacts.entity.Contact;

public class AsyncPhotoLoader extends AsyncTask<Contact, Void, Void> {

	private final Context mContext;
	private final BaseAdapter mAdapter;
	
	public AsyncPhotoLoader(Context context, BaseAdapter adapter) {
		mContext = context;
		mAdapter = adapter;
	}
	
	@Override
	protected Void doInBackground(Contact... params) {
		for (Contact contact : params) {
			contact.setPhoto(mContext);
		}
		return null;
	}
	
	@Override
	protected void onPostExecute(Void result) {
		mAdapter.notifyDataSetChanged();
	}
	
}
